import request from "@/utils/request";

export function Login(params: any) {
    return request({
        method: "post",
        url: "/login",
        data: formData(params),
    });
}

export function getAllUserInfo(params: any) {
    return request({
        method: "get",
        url: "/getAllUserInfo",
        params,
    });
}

export function getDirectList(params: any) {
    return request({
        method: "get",
        url: "/getDirectList",
        params,
    });
}

export function setUserLevel(params: any) {
    return request({
        method: "post",
        url: "/setUserLevel",
        data: formData(params),
    });
}

export function getUSDTRecordList(params: any) {
    return request({
        method: "get",
        url: "/getUSDTRecordList",
        params
    });
}

export function getAllReceive(params: any) {
    return request({
        method: "get",
        url: "/getAllReceive",
        params
    });
}

export function getAllSend(params: any) {
    return request({
        method: "get",
        url: "/getAllSend",
        params
    });
}

export function getAllTransfer(params: any) {
    return request({
        method: "get",
        url: "/getAllTransfer",
        params
    });
}

export function getAllInvest(params: any) {
    return request({
        method: "get",
        url: "/getAllInvest",
        params
    });
}

export function getParameter() {
    return request({
        method: "get",
        url: "/getParameter",
    });
}

export function setParameterAddress(params: any) {
    return request({
        method: "post",
        url: "/setParameterAddress",
        data: formData(params),
    });
}

export function setUserStatus(params: any) {
    return request({
        method: "post",
        url: "/setUserStatus",
        data: formData(params),
    });
}
export function setParameterAmount(params: any) {
    return request({
        method: "post",
        url: "/setParameterAmount",
        data: formData(params),
    });
}

export function addUSDT(params: any) {
    return request({
        method: "post",
        url: "/addUSDT",
        data: formData(params),
    });
}


export function insertAnnouncement(params: any) {
    return request({
        method: 'post',
        url: "/insertAnnouncement",
        data: formData(params)
    })
}

export function updateAnnouncement(params: any) {
    return request({
        method: 'post',
        url: "/updateAnnouncement",
        data: formData(params)
    })
}

export function setAnnouncementStatus(params: any) {
    return request({
        method: 'post',
        url: "/setAnnouncementStatus",
        data: formData(params)
    })
}

export function getAllAnnouncement(params: any) {
    return request({
        method: 'get',
        url: "/getAllAnnouncement",
        params
    })
}

const formData = (params: any) => {
    let formData = new FormData();
    for (let i in params) {
        formData.append(i, params[i]);
    }
    return formData;
};
